<?php


/**
 * 获取accessToken
 * @return mixed
 */
function getAccessToken(){
    $config = get_addon_config('wanlshop');
    $url = "https://api.weixin.qq.com/cgi-bin/token";
    $appid = $config['mp_weixin']['appid'];
    $secret = $config['mp_weixin']['appsecret'];
    $url .= "?grant_type=client_credential&appid={$appid}&secret={$secret}";
    $result = \fast\Http::get($url);
    return json_decode($result,true);
}